//
//  LoginViewController.m
//  01-UIViewHomeWork
//
//  Created by dllo on 16/7/15.
//  Copyright © 2016年 QC.L. All rights reserved.
//

#import "LoginViewController.h"
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
@interface LoginViewController ()
@property (nonatomic, assign) BOOL isSele;
@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBarController.tabBar.hidden=YES;
    self.view.backgroundColor = [UIColor whiteColor];
    [self creatLogin];
}
- (void)creatLogin {
    // 背景
    UIImageView *imageBackGround = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    [imageBackGround setImage:[UIImage imageNamed:@"welcome_2"]];
    [self.view addSubview:imageBackGround];
    // logo
    UIImageView *imageLogo = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 3, HEIGHT / 9, WIDTH / 3, 200)];
    [imageLogo setImage:[UIImage imageNamed:@"logo_lagou"]];
    [imageBackGround addSubview:imageLogo];
    
//    UIImageView *imageIphone = [[UIImageView alloc] initWithFrame:CGRectMake(20, 350, 50, 50)];
//    [imageIphone setImage:[UIImage imageNamed:@"Unknown"]];
//    [self.view addSubview:imageIphone];
//    
//    UIImageView *imageCode = [[UIImageView alloc] initWithFrame:CGRectMake(20, 350, 50, 50)];
//    [imageCode setImage:[UIImage imageNamed:@"yanzhengma"]];
//    [self.view addSubview:imageCode];
    UIButton *btnId = [UIButton buttonWithType:UIButtonTypeCustom];
    btnId.frame = CGRectMake(20, 350, 50, 50);
    btnId.backgroundColor = [UIColor blackColor];
    btnId.alpha = 0.3;
    [btnId setImage:[UIImage imageNamed:@"Unknown"] forState:UIControlStateNormal];
    [self.view addSubview:btnId];
    [btnId addTarget:self action:@selector(clickBtnID:) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *btnPassword = [UIButton buttonWithType:UIButtonTypeCustom];
    btnPassword.frame = CGRectMake(20, 410, 50, 50);
    btnPassword.backgroundColor = [UIColor blackColor];
    btnPassword.alpha = 0.3;
    [btnPassword setImage:[UIImage imageNamed:@"yanzhengma"] forState:UIControlStateNormal];
    [self.view addSubview:btnPassword];
    [btnPassword addTarget:self action:@selector(clickBtnPassWord:) forControlEvents:UIControlEventTouchUpInside];

    // 手机号
    UITextField *textIphone = [[UITextField alloc] initWithFrame:CGRectMake(90, 350, WIDTH - 120, 50)];
    textIphone.backgroundColor = [UIColor blackColor];
    textIphone.alpha = 0.2;
    [textIphone.layer setCornerRadius:10.0];
    textIphone.textColor = [UIColor lightGrayColor];
    textIphone.placeholder = @"手机号";
    textIphone.textAlignment = 1;
    textIphone.keyboardType = UIKeyboardTypeNumberPad;
    textIphone.returnKeyType = UIReturnKeyDone;
    textIphone.clearsOnBeginEditing = YES;
    textIphone.borderStyle = UITextBorderStyleBezel;
    [textIphone setValue:[UIColor lightGrayColor] forKeyPath:@"_placeholderLabel.textColor"];
    textIphone.clearsOnBeginEditing = YES;
    textIphone.textColor = [UIColor whiteColor];
    [self.view addSubview:textIphone];
    // Email
    UITextField *textEmail = [[UITextField alloc] initWithFrame:CGRectMake(90, 410, WIDTH - 210, 50)];
    textEmail.backgroundColor = [UIColor blackColor];
    textEmail.alpha = 0.2;
    [textEmail.layer setCornerRadius:10.0];
    textEmail.textColor = [UIColor lightGrayColor];
    textEmail.placeholder = @"验证码";
    textEmail.textAlignment = 1;
    textEmail.clearsOnBeginEditing = YES;
    textEmail.keyboardType = UIKeyboardTypeNumberPad;
    textEmail.returnKeyType = UIReturnKeyDone;
    textEmail.borderStyle = UITextBorderStyleBezel;
    [textEmail setValue:[UIColor lightGrayColor] forKeyPath:@"_placeholderLabel.textColor"];
    textEmail.clearsOnBeginEditing = YES;
    textEmail.textColor = [UIColor whiteColor];
    [self.view addSubview:textEmail];
    
    UIButton *btnOK = [UIButton buttonWithType:UIButtonTypeCustom];
    btnOK.frame = CGRectMake(WIDTH - 110, 410, WIDTH - 340 , 50);
    btnOK.backgroundColor = [UIColor blackColor];
    btnOK.alpha = 0.3;
    [btnOK setTitle:@"验证码" forState:UIControlStateNormal];
    [btnOK setTitleColor:[UIColor colorWithRed:0.01 green:0.79 blue:0.53 alpha:1.00] forState:UIControlStateNormal];
    [self.view addSubview:btnOK];
    
    UIButton *btnLogin = [UIButton buttonWithType:UIButtonTypeCustom];
    btnLogin.frame = CGRectMake(30, 500, WIDTH - 60 , 50);
    btnLogin.backgroundColor = [UIColor colorWithRed:0.01 green:0.79 blue:0.53 alpha:1.00];
    [btnLogin setTitle:@"注册" forState:UIControlStateNormal];
    btnLogin.alpha = 0.8;
    [btnLogin setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.view addSubview:btnLogin];
    UIButton *btnbleak = [UIButton buttonWithType:UIButtonTypeCustom];
    btnbleak.frame = CGRectMake(30 , 560, WIDTH - 60 , 50);
    btnbleak.backgroundColor = [UIColor blackColor];
    btnbleak.alpha = 0.3;
    [btnbleak setTitle:@"返回登录" forState:UIControlStateNormal];
    [btnbleak setTitleColor:[UIColor colorWithRed:0.01 green:0.79 blue:0.53 alpha:1.00] forState:UIControlStateNormal];
    [self.view addSubview:btnbleak];
    [btnbleak addTarget:self action:@selector(clickBleak:) forControlEvents:UIControlEventTouchUpInside];

}
- (void)clickBleak:(UIButton *)sender {
//    [self dismissViewControllerAnimated:YES completion:nil];
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)clickBtnID:(UIButton *)sender {
    if (self.isSele == YES) {
        [sender setImage:[UIImage imageNamed:@"icon_username"] forState:UIControlStateNormal];
    }else{
        [sender setImage:[UIImage imageNamed:@"icon_username_select"] forState:UIControlStateNormal];
    }
    // 取反赋值
    self.isSele = !self.isSele;
}
- (void)clickBtnPassWord:(UIButton *)sender {
    if (self.isSele == YES) {
        [sender setImage:[UIImage imageNamed:@"icon_password"] forState:UIControlStateNormal];
    }else{
        [sender setImage:[UIImage imageNamed:@"icon_password_select"] forState:UIControlStateNormal];
    }
    // 取反赋值
    self.isSele = !self.isSele;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
